<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/selectize.css">
    <link rel="stylesheet" href="css/selectize.bootstrap3.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" type="text/css" href="css/wangEditor.min.css">
    <link rel="stylesheet" href="css/toastr.css">
    <style type="text/css">
    .ng-binding{overflow:hidden;}
    .table>tbody>tr>td{line-height:normal;}
    </style>
</head>
<body>
<?php 
$nav='admin';
include_once './view/_top.php';
?>
<div class="container-fluid content" id="content">
    <!-- ngView:  --><div class="ng-scope"><div class="container-fluid content ng-scope" id="content">
    <div class="sidebar">
        <ul class="nav nav-sidebar">
            <li id="b" class="active"><a href="?c=admin">所有用户</a></li>
        </ul>
    </div>
    <div class="main smain">
        <div class="main-cont" style="min-width: 1064px">

            <h4 class="sub-header">项目</h4>
             
            <div style="background-color: #f5f5f5; ">
                <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
                    <div class="panel-body">

 
                        <form class="form-inline ng-pristine ng-valid">
                            <div class="form-group" style="margin-left: 20px">
                                <label>时间</label>
                                <input type="date" class="form-control ml-15">
                                <label>~</label>
                                <input type="date" class="form-control">
                            </div>


                            <button class="btn btn-default" style="margin-left: 20px;">确定</button>

                        </form>
                    </div>
                </div>
            </div>

            <div style="margin-top: 50px">
                


                <div class="hr-line-dashed"></div>
                <table class="table table-striped tables">
                    <tbody>
                    <tr>
                        <th>UID</th>
                        <th>用户名</th>
                        <th>昵称</th>
                        <th>创建时间</th>
                        <th style="text-align: left">操作</th>
                    </tr>
                    <?php 
                    if (isset($_GET['p'])) {
                    	$page=$_GET['p'];
                    }else{
                    	$page=1;
                    }
                    $pageSize=10;
                    $sql="select count(id) as count from `admin`  ";
                    $query_count = $this->mysqli->query($sql);
                    $row=$query_count->fetch_array();
                    $total=$row['count'];
                    $total_page=1;
                    if ($total) {
                    	if($total % $pageSize){
                    		$total_page=(int)($total/$pageSize)+1;
                    	}else{
                    		$total_page=($total/$pageSize);
                    	}
                    }
                    
                     
                    $sql="select * from admin order by id desc limit ".($page-1)*$pageSize.", $pageSize ";
                    
                    $query = $this->mysqli->query($sql);
                    while ($list=$query->fetch_array()){
                    ?>
                    <tr class="ng-scope">
                        <td class="ng-binding"><?php echo $list['id']; ?></td>
                        <td class="ng-binding"><?php echo $list['name']; ?></td>
                        <td class="ng-binding"><?php echo $list['nickname']; ?></td>
                        <td class="ng-binding"><?php echo $list['createtime']; ?></td>
                        <?php
                            if ($list['id'] == $_SESSION['uid']){  
                        ?>
                        <td style="text-align: left">
                            <a href="?c=admin&a=edit&id=<?php echo $list['id']; ?>"><i class="fa fa-edit"></i>修改</a>
                          <!--   <a href="javascript:void(0)" class="text-danger delbtn" data-id="<?php echo $list['id']; ?>" ><i class="fa fa-trash-o"></i>删除</a>  --> 
                         </td>
                         <?php } ?>
                    </tr>
                    <?php } ?>
                     



                    </tbody>
                </table>


                <div class="hr-line-dashed"></div>
                <div class="text-right">
                    <ul class="pagination pagination">
                    <?php $pageUrl='?a=home&p='; ?>
                        <?php if($page > 1){ ?>
					    <li><a href="<?php echo $pageUrl,$page-1; ?>">«</a></li>
					    <?php }else{ ?> 
					    <li class="disabled"><a href="javascript:void(0)">«</a></li>
					    <?php } ?>
					    <?php if($page > 2){ ?><li><a href="<?php echo $pageUrl,$page-2; ?>"><?php echo $page-2; ?></a></li><?php } ?>
                        <?php if($page > 1){ ?><li><a href="<?php echo $pageUrl,$page-1; ?>"><?php echo $page-1; ?></a></li><?php } ?>
                        <li class="active"><a href="<?php echo $pageUrl,$page; ?>"><?php echo $page; ?></a></li>
                        <?php if(($page+1) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+1; ?>" ><?php echo $page+1; ?></a></li><?php } ?>
                        <?php if(($page+2) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+2; ?>" ><?php echo $page+2; ?></a></li><?php } ?>
                         
                        <?php if(($page+1) <= $total_page){ ?><li class="disabled"><a href="<?php echo $pageUrl,$page+1; ?>">»</a></li><?php }else{ ?>
                            <li class="disabled"><a href="javascript:void(0)">»</a></li>
                        <?php } ?> 
                         
                    </ul>
                </div>
            </div>
        </div>
    </div>



</div>

 
<div class="modal fade ng-scope" id="mymodal3">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                <h4>提示</h4>
            </div>
            <div class="modal-body">
                <p>一旦删除不可恢复，是否确认</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-success delyes" data-dismiss="modal">确认</button>
            </div>
        </div>
    </div>
</div>
 
</div>
</div>

<script src="js/jquery-2.2.4.min.js"></script>
<script src="js/toastr.js"></script>
<script src="js/easing.js"></script>
<script src="js/selectize.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/wangEditor.js"></script>
<script src="js/TileHeadPic.js"></script>
<script src="js/calendar.js"></script>
<script type="text/javascript">
$(function(){
	var _id=0;
	$(".delbtn").click(function(){
		_id=$(this).attr("data-id");
		$('#mymodal3').modal('show');
	});
	$(".delyes").click(function(){
		 window.location.href="?c=admin&id="+_id;
	});
	
});
</script>
</body></html>